#include "Fingerprint-protocol.h"

int main(int argc, char const *argv[])
{
    printf("---------1握手信号-------------------\n");
    FingerprintProtocol protocol = FingerprintProtocol::makeHandshakeProtocol();
    protocol.showPacket();

    printf("------------2效验和是否正确----------------\n");

    vector<uint8_t> handShakeAckPacket = {
        0xEF, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x03, 0x00, 0x00, 0x0A};
    FingerprintProtocol handshakeAckProtocol =
        FingerprintProtocol::fromProtocolPacket(handShakeAckPacket);
    handshakeAckProtocol.showPacket();
    // 1 错误，0 正确
    cout << "handshake ack packet is error: " << handshakeAckProtocol.isPacketError() << endl;

    printf("----------3生成指纹图像探测包------------------\n");
    FingerprintProtocol detectImageProtocol = FingerprintProtocol::makeDetectImageProtocol();
    detectImageProtocol.showPacket();

    printf("----------4生成指纹图像特征码------------------\n");
    FingerprintProtocol mageFeatureProtocol = FingerprintProtocol::makeImageFeatureProtocol(0x1);
    mageFeatureProtocol.showPacket();

    printf("----------5生成特征合成模板------------------\n");
    FingerprintProtocol makeImageTemplateProtocol = FingerprintProtocol::makeImageTemplateProtocol();
    makeImageTemplateProtocol.showPacket();

    printf("----------6存储模板------------------\n");
    FingerprintProtocol storeTemplateProtocol = FingerprintProtocol::makeStoreTemplateProtocol(0x01);
    storeTemplateProtocol.showPacket();

    printf("----------7搜索模板------------------\n");
    FingerprintProtocol searchFingerPrintProtocol = FingerprintProtocol::makeSearchFingerPrintProtocol();
    searchFingerPrintProtocol.showPacket();

    printf("----------8删除指纹------------------\n");
    FingerprintProtocol DeleteFingerPrintProtocol = FingerprintProtocol::makeDeleteFingerPrintProtocol(0x01);
    DeleteFingerPrintProtocol.showPacket();

    printf("----------9清空指纹库------------------\n");
    FingerprintProtocol ClearFingerPrintProtocol = FingerprintProtocol::makeClearFingerPrintProtocol();
    ClearFingerPrintProtocol.showPacket();
    printf("----------打印数据包------------------\n");
    vector<uint8_t> packet = ClearFingerPrintProtocol.getPakcet();
    for (auto data : packet)
    {
        printf("%02x", data);
    }
    printf("\n");

    return 0;
}
